<?php defined('IN_KG') or exit('Access Invalid!');?>
<style>
    .ncsc-default-table td .sale-type {
        color: #FFF;
        background-color: #ff875a;
        display: inline-block;
        clear: both;
        padding: 2px 5px;
        margin: 5px auto 0 auto;
        position: absolute;
        float: right;
        margin-left: 52px;
        margin-top: 30.5px;
    }
</style>


<div class="tabmenu">
  <?php include template('layout/submenu');?>
</div>
<form method="get" action="index.php" target="_self">
  <table class="search-form">
    <input type="hidden" name="control" value="store_order" />
    <input type="hidden" name="op" value="index" />
    <?php if ($_GET['state_type']) { ?>
    <input type="hidden" name="state_type" value="<?php echo $_GET['state_type']; ?>" />
    <?php } ?>
    <tr>
      <td>&nbsp;</td>
      <?php if ($_GET['state_type'] == 'store_order') { ?>
      <td><input type="checkbox" id="skip_off" value="1" <?php echo $_GET['skip_off'] == 1 ? 'checked="checked"' : null;?>  name="skip_off">
        <label for="skip_off">不显示已关闭的订单</label></td>
      <?php } ?>
      <th><?php echo $lang['store_order_add_time'];?></th>
      <td class="w240">
        <input type="text" class="text w70 query_start_date" name="query_start_date" id="query_start_date" value="<?php echo $_GET['query_start_date']; ?>" />
        &nbsp;&#8211;&nbsp;
        <input id="query_end_date" class="text w70 query_end_date" type="text" name="query_end_date" value="<?php echo $_GET['query_end_date']; ?>" />
      <th>
        <select name="qtype" id="">
          <option value="buyer_id" <?php if ($_GET['qtype'] == 'buyer_id') echo 'selected="true"'; ?>>买家ID</option>
          <option value="buyer_name" <?php if ($_GET['qtype'] == 'buyer_name') echo 'selected="true"'; ?>>买家姓名</option>
          <option value="buyer_phone" <?php if ($_GET['qtype'] == 'buyer_phone') echo 'selected="true"'; ?>>买家电话</option>
          <option value="goods_name" <?php if ($_GET['qtype'] == 'goods_name') echo 'selected="true"'; ?>>商品名称</option>
          <option value="shipping_code" <?php if ($_GET['qtype'] == 'shipping_code') echo 'selected="true"'; ?>>快递单号</option>
        </select>
      </th>
      <td class="w100"><input type="text" class="text w80" name="query" value="<?php echo $_GET['query']; ?>" /></td>
      <th><?php echo $lang['store_order_order_sn'];?></th>
      <td class="w160"><input type="text" class="text w150" name="order_sn" value="<?php echo $_GET['order_sn']; ?>" /></td>
      <td class="w70 tc"><label class="submit-border">
          <input type="submit" class="submit" value="<?php echo $lang['store_order_search'];?>" />
        </label></td>
    </tr>
  </table>
</form>


<style>
  .barcode{float: right;margin-right: -100px;width: 200px;height: 30px;}
  .order .promotion { color: #555; position:relative; display:block; }
  .order .promotion-info { display:none; }
  .promotion:hover .promotion-info{*width:300px/*IE7*/;display:block;position:absolute;z-index: 999;top:70px;left: -120px;border: solid 1px #FEC500;background-color:#FFF9D4;padding:4px;border-radius:5px;width:20em}
  .promotion-info dt{width: 5em;float: left;}
  .promotion-info dd{width: 15em;float: left;}
</style>
<form method="get" action="index.php" target="_self">
  <table class="search-form">
    <input type="hidden" name="control" value="store_order" />
    <input type="hidden" name="op" value="export" />
    <?php if ($_GET['state_type']) { ?>
    <input type="hidden" name="state_type" value="<?php echo $_GET['state_type']; ?>" />
    <?php } ?>
    <tr>
      <td>&nbsp;</td>
      <td>
        <input type="checkbox" id="finance" value="1" <?php echo $_GET['finance'] == 1 ? 'checked="checked"' : null;?>  name="finance">
        <label for="finance" style="color: red">导出财务对账表</label>
      </td>
      <th><?php echo $lang['store_order_add_time'];?></th>
      <td class="w240"><input type="text" class="text w70 query_start_date" name="query_start_date" id="query_start_date" value="<?php echo $_GET['query_start_date']; ?>" />
      &nbsp;&#8211;&nbsp;
      <input id="query_end_date" class="text w70 query_end_date" type="text" name="query_end_date" value="<?php echo $_GET['query_end_date']; ?>" />
      </td>
      <th>
        <select name="qtype" id="">
          <option value="buyer_id" <?php if ($_GET['qtype'] == 'buyer_id') echo 'selected="true"'; ?>>买家ID</option>
          <option value="buyer_name" <?php if ($_GET['qtype'] == 'buyer_name') echo 'selected="true"'; ?>>买家姓名</option>
          <option value="buyer_phone" <?php if ($_GET['qtype'] == 'buyer_phone') echo 'selected="true"'; ?>>买家电话</option>
          <option value="goods_name" <?php if ($_GET['qtype'] == 'goods_name') echo 'selected="true"'; ?>>商品名称</option>
        </select>
      </th>
      <td class="w100"><input type="text" class="text w80" name="query" value="<?php echo $_GET['query']; ?>" /></td>
      <th><?php echo $lang['store_order_order_sn'];?></th>
      <td class="w160"><input type="text" class="text w150" name="order_sn" value="<?php echo $_GET['order_sn']; ?>" /></td>
      <td class="w70 tc"><label class="submit-border">
          <input type="submit" class="submit" value="导出" />
        </label></td>
    </tr>
  </table>
</form>
<table class="ncsc-default-table order">
  <thead>
    <tr>
      <th class="w10"></th>
      <th colspan="2"><?php echo $lang['store_order_goods_detail'];?></th>
      <th class="w100"><?php echo $lang['store_order_goods_single_price'];?></th>
      <th class="w40"><?php echo $lang['store_show_order_amount'];?></th>
      <th class="w100"><?php echo $lang['store_order_buyer'];?></th>
      <th class="w100"><?php echo $lang['store_order_sum'];?></th>
      <th class="w90">交易状态</th>
      <th class="w120">交易操作</th>
    </tr>
  </thead>
  <?php if (is_array($output['order_list']) and !empty($output['order_list'])) { ?>
  <?php foreach($output['order_list'] as $order_id => $order) { ?>
  <tbody>
    <tr>
      <td colspan="20" class="sep-row"></td>
    </tr>
    <tr>
      <th colspan="20"><span class="ml10"><?php echo $lang['store_order_order_sn'].$lang['nc_colon'];?><em><?php echo $order['order_sn']; ?></em>
        <?php if ($order['order_from'] == 2){?>
        <i class="icon-mobile-phone"></i>
        <?php }?>
        </span> <span><?php echo $lang['store_order_add_time'].$lang['nc_colon'];?><em class="goods-time"><?php echo date("Y-m-d H:i:s",$order['add_time']); ?></em></span>
        <?php if ($order['chain_id']) { ?>
        <span>取货方式：门店自提</span>
        <?php } ?>
        <span class="fr mr5"> <a href="index.php?control=store_order&op=order_print&order_id=<?php echo $order_id;?>" class="ncbtn-mini" target="_blank" title="打印发货单"/><i class="icon-print"></i>打印发货单</a></span> </th>
    </tr>
    <?php $i = 0;?>
    <?php $copyGoods = ''; ?>
    <?php foreach($order['goods_list'] as $k => $goods) { ?>
    <?php if ($goods['spec2']){ ?>
    <?php $copyGoods .= $goods['spec2'].x.$goods['goods_num'].',';?>
    <?php } else{?>
    <?php $copyGoods .= $goods['goods_spec'].x.$goods['goods_num'].','; ?>
    <?php } ?>
    <?php } ?>
    <?php if (!empty($order['zengpin_list'])){ ?>
        <?php $copyGoods .= ' 赠品: '.$order['zengpin_list'][0]['goods_name'].'x 1,'; ?>
    <?php  } ?>
    <?php foreach($order['goods_list'] as $k => $goods) { ?>
    <?php $i++;?>
    <tr>
      <td class="bdl"></td>
      <td class="w70"><div class="ncsc-goods-thumb"><a href="<?php echo $goods['goods_url'];?>" target="_blank"><img src="<?php echo $goods['image_60_url'];?>" onMouseOver="toolTip('<img src=<?php echo $goods['image_240_url'];?>>')" onMouseOut="toolTip()"/></a></div></td>
      <td class="tl"><dl class="goods-name" style="position: relative;">
          <dt><a target="_blank" href="<?php echo $goods['goods_url'];?>"><?php echo $goods['goods_name']; ?></a><a target="_blank" class="blue ml5" href="<?php echo urlShop('snapshot', 'index', array('rec_id' => $goods['rec_id']));?>">[交易快照]</a></dt>
          <?php if ($goods['spec2']){ ?>
          <dd><?php echo $goods['spec2'];?> x <?php echo $goods['goods_num']; ?></dd>
          <?php } else{?>
          <dd><?php echo $goods['goods_spec'];?> x <?php echo $goods['goods_num']; ?></dd>
          <?php } ?>
          <!-- S消费者保障服务 -->

          <?php if($goods["contractlist"]){?>
          <dd class="goods-cti mt5">
            <?php foreach($goods["contractlist"] as $gcitem_v){?>
            <span <?php if($gcitem_v['cti_descurl']){ ?>onclick="window.open('<?php echo $gcitem_v['cti_descurl'];?>');" style="cursor: pointer;"<?php }?> title="<?php echo $gcitem_v['cti_name']; ?>"> <img src="<?php echo $gcitem_v['cti_icon_url_60'];?>"/> </span>
            <?php }?>
          </dd>
          <?php }?>

          <!-- E消费者保障服务 -->
          <img src="/data/upload/barcodes/<?php echo $output['goods_serials'][$goods['goods_id']]; ?>.png" class="barcode" alt="">
        </dl></td>
      <td><p><?php echo ncPriceFormat($goods['goods_price']); ?></p>
        <?php if (!empty($goods['goods_type_cn'])){ ?>
        <span class="sale-type"><?php /*echo $goods['goods_type_cn'];*/?> 团购</span>
      <?php } ?></td>
      <td><?php echo $goods['goods_num']; ?></td>

      <!-- S 合并TD -->
      <?php if (($order['goods_count'] > 1 && $k ==0) || ($order['goods_count']) == 1){ ?>
      <td class="bdl" rowspan="<?php echo $order['goods_count'];?>"><div class="buyer">
          <a href="http://www.haodiaoyu.com/user/<?php echo $order['buyer_id'];?>" target="_blank"><?php echo $order['buyer_name'];?></a><br/>
          <a href="/index.php?control=store_order&op=index&state_type=store_order&qtype=buyer_id&query=<?php echo $order['buyer_id'];?>" target="_self" style="display: inline-block;"><?php echo $order['buyer_id'];?></a>
          <a href="javascript:;" style="padding-top: 5px;display: inline-block;width: 100%;" data-clipboard-text="<?php echo $copyGoods ?>" class="copybtn">复制商品</a><br/>
        <a href="javascript:;" style="padding-top: 5px;display: inline-block;width: 100%;" data-clipboard-text="<?php echo $order['extend_order_common']['reciver_name'].', '.$order['extend_order_common']['reciver_info']['phone'].', '.str_replace('，',' ',$order['extend_order_common']['reciver_info']['address']);?>" class="copybtn">复制地址</a>

          <p member_id="<?php echo $order['buyer_id'];?>">
          </p>
          <div class="buyer-info"> <em></em>
            <div class="con">
              <h3><i></i><span><?php echo $lang['store_order_buyer_info'];?></span></h3>
              <dl>
                <dt><?php echo $lang['store_order_receiver'].$lang['nc_colon'];?></dt>
                <dd><?php echo $order['extend_order_common']['reciver_name'];?></dd>
              </dl>
              <dl>
                <dt><?php echo $lang['store_order_phone'].$lang['nc_colon'];?></dt>
                <dd><?php echo $order['extend_order_common']['reciver_info']['phone'];?></dd>
              </dl>
              <dl>
                <dt>地址<?php echo $lang['nc_colon'];?></dt>
                <dd><?php echo $order['extend_order_common']['reciver_info']['address'];?></dd>
              </dl>
            </div>
          </div>
        </div></td>
      <td class="bdl" rowspan="<?php echo $order['goods_count'];?>">
          <?php if ($_GET['state_type'] == 'state_pay'){?>
              <?php if (!empty($goods['goods_type_cn']) && $order['order_type'] == 5){?>
                  <p class="ncsc-order-amount">
                    <?php echo ncPriceFormat($order['order_amount'] + $order['paid_order']['order_amount']); ?>
                  </p>
                  <p class="ncsc-order-amount">
                      含订金：<?php echo $order['order_amount']?>
                  </p>
              <?php }else{?>
                  <p class="ncsc-order-amount">
                    <?php echo $order['order_amount']; ?>
                  </p>
               <?php }?>
          <?php }else{?>
              <p class="ncsc-order-amount">
                  <?php if (!empty($goods['goods_type_cn']) && $order['order_type'] == 5){?>
                      <?php echo '订金: '.$order['order_amount']; ?>
                  <?php }else { ?>
                      <?php echo $order['order_amount']; ?>
                  <?php } ?>
              </p>

              <?php if ($order['order_type'] == 5) { ?>
                  <p class="ncsc-order-amount">
                      <?php echo '尾款: ' . $order['paid_order']['order_amount']; ?>
                  </p>
              <?php } ?>
          <?php }?>


        <p class="goods-freight">
          <?php if ($order['shipping_fee'] > 0){?>
          (<?php echo $lang['store_show_order_shipping_han']?>运费<?php echo $order['shipping_fee'];?>)
          <?php }else{?>
          <?php echo $lang['nc_common_shipping_free'];?>
          <?php }?>
        </p>
        <p class="goods-pay" title="<?php echo $lang['store_order_pay_method'].$lang['nc_colon'];?><?php echo $order['payment_name']; ?>"><?php echo $order['payment_name']; ?></p></td>
      <td class="bdl bdr" rowspan="<?php echo $order['goods_count'];?>">
        <div class="promotion">
        <p><?php echo $order['state_desc']; ?>
          <?php if($order['evaluation_time']) { ?>
          <br/>
          <?php echo $lang['store_order_evaluated'];?>
          <?php } ?>
        </p>

        <!-- 订单查看 -->

        <!--<p><a href="index.php?control=store_order&op=show_order&order_id=<?php /*echo $order_id;*/?>" target="_blank"><?php /*echo $lang['store_order_view_order'];*/?></a></p>-->
            <p><a href="index.php?control=store_order&op=show_order&order_id=<?php echo $order['order_id'];?>" target="_blank"><?php echo $lang['store_order_view_order'];?></a></p>



        <!-- 物流跟踪 -->

        <p>
          <?php if ($order['if_deliver']) { ?>
          <a href='index.php?control=store_deliver&op=search_deliver&order_sn=<?php echo $order['order_sn']; ?>'><?php echo $lang['store_order_show_deliver'];?></a>
          <?php } ?>
        </p>
        <!-- 订单优惠 -->
        <?php $promotions = unserialize($order['extend_order_common']['promotion_info']); ?>
        <?php
          $promotion_flag = false;
          if ($promotions !== false) {
            foreach ($promotions as $key => $pro) {
              if (!is_array($pro)) {
                $pro = explode('：', $pro);
              }
              if ($pro[0] == '平台红包') {
                $promotion_flag = true;
                break;
              }elseif($pro[1] > 0){
                $promotion_flag = true;
                break;
              }
            }
          }
         ?>
        <?php if ($promotion_flag !== false): ?>
        <p style="color: red">订单优惠</p>
        <div class="promotion-info">
          <div class="con">
            <?php foreach ($promotions as $key => $value): ?>
              <?php if (!is_array($value)) {
                $value = explode('：', $value);
              } ?>
              <dl><dt><?= $value[0] ?>:</dt> <dd><?= $value[1] ?></dd></dl>
            <?php endforeach ?>

          </div>
        </div>
        <?php endif ?>
        </div>
        </td>

      <!-- 取消订单 -->
      <td class="bdl bdr" rowspan="<?php echo $order['goods_count'];?>">
        <?php if ($order['old_amount'] > 0) { ?>
          <p style="color: red">曾经修改过订单价格：<?php echo $order['old_amount'];?> </p>
        <?php } ?>
      <?php if($order['if_store_cancel']) { ?>
        <p><a href="javascript:void(0)" class="ncbtn mt5" nc_type="dialog" uri="index.php?control=store_order&op=change_state&state_type=order_cancel&order_sn=<?php echo $order['order_sn']; ?>&order_id=<?php echo $order['order_id']; ?>" dialog_title="<?php echo $lang['store_order_cancel_order'];?>" dialog_id="seller_order_cancel_order" dialog_width="400" id="order<?php echo $order['order_id']; ?>_action_cancel" /><i class="icon-remove-circle"></i><?php echo $lang['store_order_cancel_order'];?></a></p>
        <?php } ?>

        <!-- 修改运费价格 -->

        <?php if ($order['if_modify_price']) { ?>
        <p><a href="javascript:void(0)" class="ncbtn-mini ncbtn-bittersweet mt10" uri="index.php?control=store_order&op=change_state&state_type=modify_price&order_sn=<?php echo $order['order_sn']; ?>&order_id=<?php echo $order['order_id']; ?>" dialog_width="480" dialog_title="<?php echo $lang['store_order_modify_price'];?>" nc_type="dialog"  dialog_id="seller_order_adjust_fee" id="order<?php echo $order['order_id']; ?>_action_adjust_fee" /><i class="icon-pencil"></i>修改运费</a></p>
        <?php }?>
        <!--修改订单价格-->
        <?php if ($order['if_spay_price']) { ?>
        <p><a href="javascript:void(0)" class="ncbtn-mini ncbtn-bluejeansjeans mt10" uri="index.php?control=store_order&op=change_state&state_type=spay_price&order_sn=<?php echo $order['order_sn']; ?>&order_id=<?php echo $order['order_id']; ?>" dialog_width="480" dialog_title="<?php echo $lang['store_order_modify_price'];?>" nc_type="dialog"  dialog_id="seller_order_adjust_fee" id="order<?php echo $order['order_id']; ?>_action_adjust_fee" /><i class="icon-pencil"></i>修改价格</a></p>
		<?php }?>

        <!-- 发货 -->
              <?php if ($order['if_store_send']) { ?>
                  <?php if ($order['order_type'] == 4 || $order['order_type'] == 5){?>
                      <?php if ($order['order_state'] == 20){?>
                          <p><a class="ncbtn ncbtn-mint mt10" href="index.php?control=store_deliver&op=send&order_id=<?php echo $order['order_id']; ?>"/><i class="icon-truck"></i><?php echo $lang['store_order_send'];?></a></p>
                      <?php }?>
                  <?php }else{?>
                      <p><a class="ncbtn ncbtn-mint mt10" href="index.php?control=store_deliver&op=send&order_id=<?php echo $order['order_id']; ?>"/><i class="icon-truck"></i><?php echo $lang['store_order_send'];?></a></p>
                  <?php }?>
              <?php } ?>





        <!-- 锁定 -->
        <?php /*if ($order['if_lock']) {*/?><!--
        <p><?php /*echo '退款退货中';*/?></p>
        --><?php /*}*/?>

              <?php if ($order['if_lock']&& !in_array($order['order_type'],array(4,5))) {?>
                  <p><?php echo '退款退货中';?></p>
              <?php }?>
        </td>
      <?php } ?>
      <!-- E 合并TD -->
    </tr>

    <!-- S 赠品列表 -->
    <?php if (!empty($order['zengpin_list']) && $i == count($order['goods_list'])) { ?>
    <tr>
      <td class="bdl"></td>
      <td colspan="4" class="tl">
          <div class="ncsc-goods-gift" style="text-align: right;"><label for="" style="color: red">赠品</label>：
              <ul>
                <?php foreach ($order['zengpin_list'] as $zengpin_info) { ?>
                <li> <a title="赠品：<?php echo $zengpin_info['goods_name'];?> * <?php echo $zengpin_info['goods_num'];?>" href="<?php echo $zengpin_info['goods_url'];?>" target="_blank"><img src="<?php echo $zengpin_info['image_60_url'];?>" onMouseOver="toolTip('<img src=<?php echo $zengpin_info['image_240_url'];?>>')" onMouseOut="toolTip()"/></a>
                </li>
              </ul>
              <p style="padding-right: 10px;">
                  <?php echo $zengpin_info['goods_source_name'] ?> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $zengpin_info['goods_serial'] ?>
              </p>
              <p style="text-align: left">
                  <img src="/data/upload/barcodes/<?php echo $zengpin_info['goods_serial'] ?>.png" class="barcode" alt="" style="    margin-right: 40px;">
              </p>
          <?php } ?>
        </div>
      </td>
    </tr>
    <?php } ?>
    <!-- E 赠品列表 -->

    <!-- S 预定时段 -->
    <?php if ($order['order_type'] == 2 && $i == count($order['goods_list'])) { ?>
    <?php if (is_array($order['book_list'])) { ?>
    <?php foreach($order['book_list'] as $book_info) {?>
    <tr>
      <td class="bdl"></td>
      <td colspan="2"><?php echo $book_info['book_step'];?></td>
      <td colspan="2"><?php echo $book_info['book_amount'].$book_info['book_amount_ext'];?></td>
      <td colspan="2"><?php echo $book_info['book_state'];?></td>
      <td class="bdr" colspan="2"></td>
    </tr>
    <?php } ?>
    <?php } ?>
    <?php } ?>
    <!-- E 预定时段 -->

    <?php } ?>
    <!-- 备注 -->
    <tr>
      <td colspan="2" style="border-right:1px solid #E6E6E6;background:#E6E6E6;"><p style="color: red">卖家留言</p></td>
      <td colspan="6" style="border-right:1px solid #E6E6E6;border-left:1px solid #E6E6E6;background:#E6E6E6;">
        <p style="color: red"><?php echo $order['remark']['remark'];?></p>
      </td>
      <td style="border-right:1px solid #E6E6E6;background:#E6E6E6;">
        <?php if ($order['remark']) {?>
        <p><a class="ncbtn-mini ncbtn-bluejeansjeans mt10" style="margin-top:0 !important" href="javascript:;" uri="index.php?control=store_order&op=change_remark&order_id=<?php echo $order['order_id']; ?>" dialog_width="480" dialog_title="<?php echo $lang['store_order_modify_price'];?>" nc_type="dialog"  dialog_id="seller_order_remark" id="order<?php echo $order['order_id']; ?>_remark"/><i class="icon-truck"></i>修改备注</a></p>
        <?php }else {?>
        <p><a class="ncbtn mt10" style="margin-top:0 !important" href="javascript:;" uri="index.php?control=store_order&op=change_remark&order_id=<?php echo $order['order_id']; ?>" dialog_width="480" dialog_title="<?php echo $lang['store_order_modify_price'];?>" nc_type="dialog"  dialog_id="seller_order_remark" id="order<?php echo $order['order_id']; ?>_remark"/><i class="icon-truck"></i>添加备注</a></p>
        <?php } ?>
      </td>
    </tr>
    <tr>
      <td colspan="2" style="border-right:1px solid #c5c5c5;background:#c5c5c5;"><p style="color: red">买家留言</p></td>
      <td colspan="8" style="border-right:1px solid #c5c5c5;border-left:1px solid #c5c5c5;background:#c5c5c5;">
        <p style="color: red"><?php echo $order['extend_order_common']['order_message']; ?></p>
      </td>
    </tr>
    <?php } } else { ?>
    <tr>
      <td colspan="20" class="norecord"><div class="warning-option"><i class="icon-warning-sign"></i><span><?php echo $lang['no_record'];?></span></div></td>
    </tr>
    <?php } ?>
  </tbody>
  <tfoot>
    <?php if (is_array($output['order_list']) and !empty($output['order_list'])) { ?>
    <tr>
      <td colspan="20"><div class="pagination"><?php echo $output['show_page']; ?></div></td>
    </tr>
    <?php } ?>
  </tfoot>
</table>
<script charset="utf-8" type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/jquery-ui/i18n/zh-CN.js" ></script>
<link rel="stylesheet" type="text/css" href="<?php echo RESOURCE_SITE_URL;?>/js/jquery-ui/themes/ui-lightness/jquery.ui.css"  />
<script src="<?php echo RESOURCE_SITE_URL;?>/js/clipboard.min.js"></script>
<script type="text/javascript">
$(function(){
    $('.query_start_date').datepicker({dateFormat: 'yy-mm-dd'});
    $('.query_end_date').datepicker({dateFormat: 'yy-mm-dd'});
    $('.checkall_s').click(function(){
        var if_check = $(this).attr('checked');
        $('.checkitem').each(function(){
            if(!this.disabled)
            {
                $(this).attr('checked', if_check);
            }
        });
        $('.checkall_s').attr('checked', if_check);
    });
    $('#skip_off').click(function(){
        url = location.href.replace(/&skip_off=\d*/g,'');
        window.location.href = url + '&skip_off=' + ($('#skip_off').attr('checked') ? '1' : '0');
    });
});
var clipboard = new Clipboard('.copybtn');
clipboard.on('success', function(e) {
    alert('复制成功');
    e.clearSelection();
});
clipboard.on('error', function(e) {
  prompt("复制失败, 请用Ctrl+C复制内容",e.text);
});
	//分享--复制
		// function copyLink(that){
		// 	var that = $(that);
		// 	var content = '';
		// 	content = that.data('content');
		//     if(window.clipboardData){
		//         window.clipboardData.clearData();
		//         window.clipboardData.setData("Text",content);
		//         alert("复制成功，分享给你的好友吧!");
		//     }else{
		//         prompt("您用的浏览器非IE核心请用Ctrl+C复制内容",content);
		//         return false;
		//     }
		// }
</script>
